#!/bin/bash
MONGO_LOG=/tmp/mongo.log
mongo 127.0.0.1:27017/admin > ${MONGO_LOG}  <<EOF

use connected-pdf
db.createCollection('messageTemplate')
db.messageTemplate.ensureIndex({"_etag":1},{"name":"IX_etag"})
db.messageTemplate.remove({})
db.messageTemplate.save({ "templateType" : 1, "messageType" : 4, "width" : 350, "height" : 460, "duration" : 30, "createTime" : "2015-12-23 08:39:36"})
db.messageTemplate.save({ "templateType" : 1, "messageType" : 5, "width" : 350,"height" : 570, "duration" : 30, "createTime" : "2015-12-24 08:39:36"})
db.messageTemplate.save({"templateType" : 1, "messageType" : 3, "width" : 350, "height" : 340, "duration" : 30, "createTime" : "2015-12-24 08:39:36"})
db.messageTemplate.save({"templateType" : 1, "messageType" : 11, "width" : 350, "height" : 450, "duration" : 30, "createTime" : "2016-01-15 08:39:36"})
db.messageTemplate.save({"templateType": 1, "messageType": 6, "width" : 350, "height" : 310, "duration": 30, "createTime": "2015-12-24 08:39:36"})
db.messageTemplate.save({"templateType": 1, "messageType": 8, "width" : 350, "height" : 235, "duration": 30, "createTime": "2015-12-24 08:39:36"})
db.messageTemplate.save({"templateType": 1, "messageType": 12, "width" : 350, "height" : 380, "duration": 30, "createTime": "2015-12-24 08:39:36"})
db.messageTemplate.save({"templateType": 1, "messageType": 2, "width" : 350, "height" : 310, "duration": 30, "createTime": "2015-12-24 08:39:36"})
EOF

echo "MongoDB initialized, log file is at ${MONGO_LOG}."
touch /tmp/MONGOINITED
